<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { ArrowDown } from "@element-plus/icons-vue";
const router = useRouter();
const activeIndex = ref<any>("home");
const circleUrl = ref<any>("src/assets/images/normal.png");
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};
onMounted(() => {
  // const { name, query } = route as any;
  // activeIndex.value = query.id ? `${name}-${query.id}` : name;
});

const onGoPersonalCenter = () => {
  router.push({
    name: "PersonalCenter",
  });
};
</script>
<template>
  <div class="header">
    <div class="logo">
      <img src="@/assets/images/logo.png" alt="" />
    </div>
    <div class="right">
      <el-dropdown>
        <span class="el-dropdown-link">
          <el-avatar :size="30" :src="circleUrl" />
          <span class="name">系统管理员</span>
          <el-icon class="el-icon--right" color="#fff">
            <arrow-down />
          </el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item @click="onGoPersonalCenter"
              >个人中心</el-dropdown-item
            >
            <el-dropdown-item command="2">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </div>
</template>
<style lang="scss" scoped>
:deep(.el-tooltip__trigger:focus-visible) {
  outline: unset;
}
.header {
  height: 60px;
  padding: 0 10px;
  width: 100%;
  background: #2d8461;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .logo {
    width: 325px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .right {
    .el-dropdown-link {
      display: flex;
      align-items: center;
      .name {
        margin: 0 6px;
        color: #fff;
      }
    }
  }
}
</style>
